#!/bin/bash
# login to CF credhub on work computer
# run:
#    CREDHUB_PWD=xxx cf_credhub_login

CREDHUB_HOST=credhub.fin.cian.ru
CREDHUB_LOGIN=credhub_admin_client

if [[ "x$CREDHUB_PWD" == "x" ]]; then
    echo "Please set CREDHUB_PWD env var"
    exit -1
fi 

credhub api ${CREDHUB_HOST} --skip-tls-validation
credhub login --client-name=${CREDHUB_LOGIN} --client-secret=${CREDHUB_PWD}
